@typeparam TItem

@typeparam TValue

@inherits BaseInputBlock<ICollection<TValue>>

@namespace FluentCMS.Web.UI.Components

@if (Visible)
{
    <FormField Cols="Cols" Dense="@Dense" Id="@Id" Hint="@Hint" Label="@Label" LabelFragment="@LabelFragment" Required="@Required">
        <select @ref="Element" @attributes="AdditionalAttributes" Placeholder="@Placeholder" multiple autocomplete="off" class="@this.GetClasses()" disabled="@Disabled" id="@Id"
                name="@NameAttributeValue">
            @if (!string.IsNullOrEmpty(Placeholder))
            {
                <option disabled value="null">@Placeholder</option>
            }
            @if (ChildContent == null)
            {
                if (Data != null && Data.Any())
                {
                    @foreach (var item in Data)
                    {
                        <option @key="@GetValue(item)" selected="@IsSelected(item)" value="@GetValue(item)">@GetText(item)</option>
                    }
                }
            }
            else
            {
                @ChildContent
            }
        </select>
    </FormField>
}